package com.liukai.personalbills.util;

import com.liukai.personalbills.retrofitInterface.AccountAPI;
import com.liukai.personalbills.retrofitInterface.UserAPI;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitManager {

    private static Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(TextUtil.URL)
            // 转换器，自动将json转换成对应的JavaBean
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    private static Retrofit getRetrofit(){
        return retrofit;
    }

    public static UserAPI getUserAPI(){
        return RetrofitManager.getRetrofit().create(UserAPI.class);
    }

    public static AccountAPI getAccountAPI(){
        return RetrofitManager.getRetrofit().create(AccountAPI.class);
    }

}
